package com.xxq.servlet;

import java.io.IOException;
import java.sql.Date;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.dbutils.QueryRunner;

import com.mysql.jdbc.Connection;

import com.xxq.db.*;

@SuppressWarnings("serial")
@WebServlet("/mission")
public class MissionServlet extends HttpServlet{
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.getRequestDispatcher("/mission.jsp").forward(request, response);
		this.doPost(request, response);
	}
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		request.setCharacterEncoding("utf-8");
	// runner = new QueryRunner();
		String name = request.getParameter("name");
		String phone = request.getParameter("phone");
		String mail = request.getParameter("mail");
		String style = request.getParameter("style");
		String kind = request.getParameter("kind");
		String address = request.getParameter("address");
		String show = request.getParameter("show");
		//System.out.println(name);
		
	// conn = (Connection) DBManager.getConnection();
		String sql = "insert into mission values(null,?,?,?,?,?,?,?);";
		BaseDao.updateSql(sql,name,phone,mail,style,kind,address,show);
	//	request.getRequestDispatcher("index.html").forward(request,response);
	}
}
